package com.edmond.jyframe.adapter;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.edmond.jyframe.R;
import com.edmond.jyframe.classes.MineTool;
import com.edmond.jyframe.interfaces.module.MineToolModelInterface;

import java.util.List;

/**
 * Created by edmond on 17-4-25.
 */

public class MineToolsAdapter extends BaseNormalAdapter<MineTool> {
    public MineToolsAdapter(Context context, List<MineTool> data) {
        super(context, data);
    }

    @Override
    public BaseItem initItem(ViewGroup parent) {
        View view = getInflater().inflate(R.layout.item_mine_tool,parent,false);
        return new MineToolItem(view);
    }

    @Override
    public void bindItem(BaseItem item, int position) {
        ((MineToolItem)item).imageView.setImageResource(getData().get(position).getImageRsId());
        ((MineToolItem)item).textView.setText(getData().get(position).getTitleRsId());
        ((MineToolItem)item).itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.d("sfsd","dsfsd");
            }
        });
    }

    class MineToolItem extends Item{

        private ImageView imageView;
        private TextView textView;

        public MineToolItem(View itemView) {
            super(itemView);
        }

        @Override
        public void initViews(View view) {
            imageView = (ImageView) view.findViewById(R.id.tool_logo);
            textView = (TextView) view.findViewById(R.id.tool_name);
        }
    }
}
